package com.aios.action.user.iris;

import com.aios.util.DataManipulator;

public class IrisUserSortAction extends AbstractIrisUserAction {

	private static final long serialVersionUID = 1L;

	private String sortBy;

	public String execute() {
		if (sortBy != null && !sortBy.equals("")) {

			DataManipulator manipulator = new DataManipulator();

			if (getManipulatorSessionVariable() != null) {
				getManipulatorSessionVariable().setSortBy(sortBy);
				getManipulatorSessionVariable().setSortOrder("ASC");
				manipulator = getManipulatorSessionVariable();

			} else {
				manipulator.clearSearchParam();
				manipulator.setSortBy(sortBy);
				manipulator.setSortOrder("ASC");
				manipulator.setDataType("iris_user");
				addManipulatorSessionVariable(manipulator);
			}

			pager = irisUserService.viewPaginatedActiveList(pageStart,
					pageSize, manipulator);
			pager = setActionContext(pager);

		}

		return SUCCESS;
	}

	public String getSortBy() {
		return sortBy;
	}

	public void setSortBy(String sortBy) {
		this.sortBy = sortBy;
	}

}
